// 路由拦截
import router from "./router";
import memoryUtils from "../src/utils/memoryUtils";
router.beforeEach((to,form,next)=>{
    // console.log(memoryUtils.user);
    const user = memoryUtils.user;
    if(user && user._id){
    if(to.path == "/login"){
        next({path:'/home'})
    }else{
        next()
    }
}else{
    if(to.path === '/login'){
        next();
    }else{
         next({path:'/login'})
    }
}
})
